Go Back   I-Mockery Forum > I-Mockery Miscellaneous Forums > Questions, Suggestions, and Tech Support
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 1st, 2004, 10:57 AM        i need a javascript
anyone here good at writing javascripts?
Reply With Quote
  #2  
AChimp AChimp is offline
Resident Chimp
AChimp's Avatar
Join Date: Nov 2000
Location: The Jungles of Borneo
AChimp is probably a real personAChimp is probably a real person
Old Aug 1st, 2004, 01:35 PM       
Depends on what it's supposed to do.
Reply With Quote
  #3  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 1st, 2004, 02:13 PM       


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.
Reply With Quote
  #4  
AChimp AChimp is offline
Resident Chimp
AChimp's Avatar
Join Date: Nov 2000
Location: The Jungles of Borneo
AChimp is probably a real personAChimp is probably a real person
Old Aug 1st, 2004, 03:06 PM       
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.
Reply With Quote
  #5  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 1st, 2004, 04:27 PM       
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
Reply With Quote
  #6  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 1st, 2004, 04:29 PM       
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
Reply With Quote
  #7  
AChimp AChimp is offline
Resident Chimp
AChimp's Avatar
Join Date: Nov 2000
Location: The Jungles of Borneo
AChimp is probably a real personAChimp is probably a real person
Old Aug 1st, 2004, 05:54 PM       
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.
Reply With Quote
  #8  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 1st, 2004, 07:48 PM       
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.
Reply With Quote
  #9  
whoreable whoreable is offline
Mocker
whoreable's Avatar
Join Date: Feb 2003
whoreable is probably a spambot
Old Aug 1st, 2004, 10:14 PM       
i believe div would work
Reply With Quote
  #10  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 1st, 2004, 11:48 PM       
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.
Reply With Quote
  #11  
whoreable whoreable is offline
Mocker
whoreable's Avatar
Join Date: Feb 2003
whoreable is probably a spambot
Old Aug 2nd, 2004, 02:11 AM       
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")>
Reply With Quote
  #12  
AChimp AChimp is offline
Resident Chimp
AChimp's Avatar
Join Date: Nov 2000
Location: The Jungles of Borneo
AChimp is probably a real personAChimp is probably a real person
Old Aug 2nd, 2004, 09:38 AM       
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.
Reply With Quote
  #13  
AChimp AChimp is offline
Resident Chimp
AChimp's Avatar
Join Date: Nov 2000
Location: The Jungles of Borneo
AChimp is probably a real personAChimp is probably a real person
Old Aug 2nd, 2004, 09:41 AM       
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.
Reply With Quote
  #14  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 2nd, 2004, 09:42 AM       
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?
Reply With Quote
  #15  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 2nd, 2004, 09:56 AM       
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>
Reply With Quote
  #16  
AChimp AChimp is offline
Resident Chimp
AChimp's Avatar
Join Date: Nov 2000
Location: The Jungles of Borneo
AChimp is probably a real personAChimp is probably a real person
Old Aug 2nd, 2004, 10:22 AM       
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.
Reply With Quote
  #17  
whoreable whoreable is offline
Mocker
whoreable's Avatar
Join Date: Feb 2003
whoreable is probably a spambot
Old Aug 2nd, 2004, 11:08 AM       
yea from what i have seen that should be mozilla, safari, netscape compatible as well.
Reply With Quote
  #18  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 2nd, 2004, 11:12 AM       
!!!!!!!!!
kick ass

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

Thanks!!
Reply With Quote
  #19  
Anonymous Anonymous is offline
Junior Member
 
Join Date: Jan 2003
Anonymous is probably a spambot
Old Aug 2nd, 2004, 01:12 PM       
looks like it's a go. works great
seriously thanks to both of you guys for helping
Reply With Quote
Reply


Thread Tools
Display Modes

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
Forum Jump

   


All times are GMT -4. The time now is 12:34 PM.


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