Go Back   I-Mockery Forum > I-Mockery Miscellaneous Forums > Questions, Suggestions, and Tech Support > i need a javascript
FAQ Members List Calendar Today's Posts

Thread: i need a javascript Reply to Thread
Title:
Message
Image Verification
Please enter the six letters or digits that appear in the image opposite.


Additional Options
Miscellaneous Options

Topic Review (Newest First)
Aug 2nd, 2004 01:12 PM
Anonymous looks like it's a go. works great
seriously thanks to both of you guys for helping
Aug 2nd, 2004 11:12 AM
Anonymous !!!!!!!!!
kick ass

I need to find someone with a mac to test this out for me

Thanks!!
Aug 2nd, 2004 11:08 AM
whoreable yea from what i have seen that should be mozilla, safari, netscape compatible as well.
Aug 2nd, 2004 10:22 AM
AChimp Booyah.

Code:
<html>

<head>

<title>flash test</title>

<script language="JavaScript" type="text/JavaScript">

function change_swf( shape )
{
  var file_name= shape + ".swf";
  var line="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='300' height='300'> <param name='movie' value='"+file_name+"'> <param name='quality' value='high'> <embed src='"+file_name+"' quality='high' bgcolor='#ffffff' width='300' height='300' name='"+file_name+"' align='middle' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed></object>";
  document.getElementById("flash").innerHTML = line;
}

</script>

</head>


<body>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="500" id="AutoNumber1">
  <tr>
    <td width="14%">
    <form method="POST" action="--WEBBOT-SELF--">
      <p align="center">
      [img]triangle.gif[/img]

      <input type="radio" value="triangle" name="shapes" checked onClick="change_swf('triangle');"></p>
      <p align="center">
      [img]circle.gif[/img]

      <input type="radio" value="circle" name="shapes" onClick="change_swf('circle');"></p>
      <p align="center">[img]star.gif[/img]

	<input type="radio" value="star" name="shapes" onClick="change_swf('star');"></p>
      

What's your name?

      <input type="text" size="20" value="Enter your name here!">

      <p align="center"><input type="submit" value="Submit" name="B1"></p>
      </p>
    </form>
    

</td>
    <td width="86%" align="center">
	   	<div id="flash">
			<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="300" height="300" id="triangle" align="middle">
			<param name="allowScriptAccess" value="sameDomain" />
			<param name="movie" value="triangle.swf" />
			<param name="quality" value="high" />
			<param name="bgcolor" value="#ffffff" />
			<embed src="triangle.swf" quality="high" bgcolor="#ffffff" width="300" height="300" name="triangle" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>
		</div>
	</td>
  </tr>
  </table>

</body>

</html>
This works for me. It's essentially the same as the script you found, Doopa, but I kept getting errors in the onClick parts. It didn't like being send a filename for some reason, so I just send the shape name and build the filename in the function.

I'm using IE6 SP2.
Aug 2nd, 2004 09:56 AM
Anonymous and here's me trying to use that code I got off the french site. I don't get any errors, but the image just won't switch
??


--------------


<script language="JavaScript" type="text/JavaScript">
function change_swf(file_name)
{
var line="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='300' height='300'> <param name='movie' value='"+file_name+"'> <param name='quality' value='high'> <embed src='"+file_name+"' quality='high' bgcolor="#ffffff" width="300" height="300" name="+file_name+" align="middle" pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>
</object> ";
document.getElementById("flash").innerHTML = line;
}
</script>

</head>

<body>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="500" id="AutoNumber1">
<tr>
<td width="14%">
<form method="POST" action="--WEBBOT-SELF--">
<p align="center">
[img]triangle.gif[/img]

<input type="radio" value="triangle" name="shapes" checked onClick="javascript:change_swf('triangle.swf');"></p>
<p align="center">
[img]circle.gif[/img]

<input type="radio" value="circle" name="shapes" onClick="javascript:change_swf('circle.swf');"></p>
<p align="center">[img]star.gif[/img]

<input type="radio" value="star" name="shapes" onClick="javascript:change_swf('star.swf');"></p>


What's your name?

<input type="text" size="20" value="Enter your name here!">

<p align="center"><input type="submit" value="Submit" name="B1"></p>
</p>
</form>


</td>
<td width="86%" align="center">
<div id="flash">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="300" height="300" id="triangle" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="triangle.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="triangle.swf" quality="high" bgcolor="#ffffff" width="300" height="300" name="triangle" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></td>
</div>
</tr>
</table>
Aug 2nd, 2004 09:42 AM
Anonymous ok. That works great but... it's switching the text not the htm file.
So... say instead of loading the contents of "star.htm" it's just loading the words "star.htm".

Here's what I put:
<input type="radio" value="triangle" name="shapes" checked onclick=test("triangle.htm")>

am I missing something?
Aug 2nd, 2004 09:41 AM
AChimp You should be able to get the onClick/etc methods to call multiple functions by doing something like this:

onClick="func1(arg, arg); func2(arg, arg);"

You're really just giving it a Javascript to run when the event is detected.
Aug 2nd, 2004 09:38 AM
AChimp Yeah, you can layer divs ontop of each other. That's how mouse-over menus work: they make a table on a new layer and then change the z-index so that it's hidden behind the main layer, and brings it forward whenever needed.

The layers should be fairly browser compatible with respect to IE and Netscape. Not sure about Opera/Mozilla, though.
Aug 2nd, 2004 02:11 AM
whoreable you can do an onclick to call a function to change the html in the div

using innerhtml

should just be able to change the link to the flash file

that is assuming you just need to change the html on the page to change the flash file



<script language="JavaScript">

function test(link1)
{
document.getElementById('test1').innerHTML=link1;
}
</script>

<div id=test1>
test
</div>
<input type="button" value="1" onclick=test("linkforswf1")>
<input type="button" value="2" onclick=test("linkforswf2")>
<input type="button" value="3" onclick=test("linkforswf3")>
Aug 1st, 2004 11:48 PM
Anonymous yeah I think you're right
I found a script that uses a div to hide and unhide a flash file and it seems to work great. I don't know how cross-compatible it is though.

I have to figure out how to edit it to respond to onclicks instead and test it.

*edit* and I don't understand yet how to get it to load different movies. because it calls the div "swf" and then controls it by: onMouseover="hide('swf')"
so.... how would I get it to load different... divs? Can you layer divs on each other or something?

It's late and bedtime... and i'm confused. Maybe this will make sense in the morning.
Aug 1st, 2004 10:14 PM
whoreable i believe div would work
Aug 1st, 2004 07:48 PM
Anonymous Thanks for taking a look
Yeah.. I read about using layers, but i've never worked with them myself so I don't know much about them. I thought I read though that it can be difficult to use them crossplatform and get everything to line up the same and not be buggy.
Also, I will be passing this page off to someone else to add their own extra code to it, and supposedly they are not very good at this shit so they would most likely fuck it up. But it's a possibility.

I read something about using <DIV> tags, but I don't know if it was in reference to the same thing, or if it's another way around doing it. It was a very vague reference

Rog's suggestion was to use iframe, which also seems like it will have cross platform issues because supposed netscape doesn't support. And I am not really supposed to use any frames as far as I know.

This is very frustrating. Lemme know what yer friends say.
Aug 1st, 2004 05:54 PM
AChimp Well, it seems possible, but I'm still trying to figure out the object hierarchy. I've never had to change anything with embeds. It seems that the <object> wrapper hides the embed tag inside it and you can't access it. The embed doesn't even show up in the document's hierarchy when I output it unless I remove the <object> tags.

I'm able to access the embed's properties when I remove the object stuff, but that'll make it incompatible with some browsers. Embeds also don't seem to refresh when their properties change; I'm sure there's a way to force them to, but without the object wrapper this route is probably bad.

Now that I've examined this a bit more, this looks like something that should be done with layers. Each time the use clicks on one of the radio buttons, just move the appropriate layer to the top. :/

EDIT: I'll ask some of my l33t cr3w about this.
Aug 1st, 2004 04:29 PM
Anonymous
Quote:
Can't guarantee that it will be really browser compatible, though,
that is super important though. It doesn't have to be old browser compatible necessarily, but it can't be the kind of thing that won't work on IE on Mac at all or whatever. It has to be at least decently compatible
Aug 1st, 2004 04:27 PM
Anonymous I thought it would be straight forward too, but I dunno now..

I posted this on flash kit too but so far no replies.

I emailed some files for you to play with if you really think you can figure something out. I had to make them up though becuase I havent actually begun building the pages right now. I need to know if it's possible first

thanks
Aug 1st, 2004 03:06 PM
AChimp That seems pretty straightforward. I could probably figure it out tomorrow if you sent me a sample HTML file and the SWF's to play with. I think it would be really easy if the SWF's had the same name as the Option value for the radio buttons.

Can't guarantee that it will be really browser compatible, though, but there shouldn't really be any problems since this is just a "if I click this, change that" problem.
Aug 1st, 2004 02:13 PM
Anonymous

I need the user to be able to click on option in the form field on the left and have that load the appropriate SWF file to the right.

No, the entire page cannot be flash. The left side must be HTML.

I can't use frames.

I need the script to be pretty browser/platform compatible.

It doesn't have to be a javascript solution necessarily, I just thought that would be the way to do it.
Aug 1st, 2004 01:35 PM
AChimp Depends on what it's supposed to do.
Aug 1st, 2004 10:57 AM
Anonymous
i need a javascript

anyone here good at writing javascripts?

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

   


All times are GMT -4. The time now is 04:35 PM.


© 2008 I-Mockery.com
Powered by: vBulletin
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.