DHTML Forum  

Go Back   DHTML Forum > dhtmlcentral.com > Crossbrowser DHTML
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09.12.2003, 14:03
reallylongaddress reallylongaddress is offline
Neuer Benutzer
 
Join Date: 09.12.2003
Location:
Posts: 1
Default

Hi all,

I have a situation where i have to dynamically produce javascript, so i can't use a static (.js) file, and would prefer not to bounce the request off a php script (for simplicity's sake). The following works in Mozilla but not in IE...any suggestions appreciated....

var rem_date_td_2_js = document.createElement("script");
rem_date_td_2_js.type = 'text/javascript';
rem_date_td_2_js.id = 'js_rem_date_' + new_section_counter;
rem_date_td_2_js.text = "var cal_rem_date_" + new_section_counter + " = new CalendarPopup ();"

Thanks,
Dominic
madison.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 09.12.2003, 15:00
Tim Scarfe Tim Scarfe is offline
Erfahrener Benutzer
 
Join Date: 14.05.2001
Location: United Kingdom
Posts: 1.015
Default

At a glance it's probably the .text property that is throwing IE off.

Try actually inserting this new element into the document somewhere, too.

--
Regards,
Tim Scarfe <tim@developer-x.com>
http://www.developer-x.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 09.12.2003, 16:11
ttrenka ttrenka is offline
Erfahrener Benutzer
 
Join Date: 10.11.2001
Location:
Posts: 1.005
Default

[code:v8v04he5oo]rrm_date_td_2_js.appendChild(
document.createTextNode(
"var cal_rem_date_" + new_section_counter + " = new CalendarPopup ();"
)
) ;[/code:v8v04he5oo]

No idea if it works, though.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 09.12.2003, 16:45
Mark Mark is offline
Erfahrener Benutzer
 
Join Date: 28.02.2002
Location: Netherlands
Posts: 2.853
Default

You seem to be creating this "dynamic script" from another script... so you are already running JavaScript. Simply do this:
[code:565fkr46ub]window["cal_rem_date_" + new_section_counter] = new CalendarPopup ();[/code:565fkr46ub]

- [url="http://neo.dzygn.com/"]Mark[/url:565fkr46ub]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 09.12.2003, 19:36
Tim Scarfe Tim Scarfe is offline
Erfahrener Benutzer
 
Join Date: 14.05.2001
Location: United Kingdom
Posts: 1.015
Default

lol!

No Mark that's far too simple..

--
Regards,
Tim Scarfe <tim@developer-x.com>
http://www.developer-x.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 10.12.2003, 20:42
Brian Nickel Brian Nickel is offline
Erfahrener Benutzer
 
Join Date: 11.05.2001
Location: USA
Posts: 1.157
Default

<blockquote id="quote"><span class="smalltext" id="quote">quote:<hr id="quote">[code:f04aj7sxbg]window["cal_rem_date_" + new_section_counter] = new CalendarPopup ();[/code:f04aj7sxbg]<hr id="quote"></blockquote id="quote"></span id="quote">Way to make everyone else look foolish (especially me, as I stared at the question pondering solutions).

If you want to be really fancy about it, you could do:
[code:f04aj7sxbg]var cal_rem_date = [];
call_rem_date[ call_rem_date.length ] = new CalendarPopup( );[/code:f04aj7sxbg]

Then you could do things like:
[code:f04aj7sxbg]for( var i = 0; i < call_rem_date.length; i ++ )
call_rem_date.method( );[/code:f04aj7sxbg]

<font color="brown"><font face="Courier New">.Brian</font id="Courier New">
<font size="2">Email: kerrick[at]gmx[dot]net - AIM: Brian K Nickel - Yahoo: brian_nickel - Jabber: Kerrick[at]jabber[dot]org - MSN: kerrick[at]gmx[dot]net - ICQ: 118451560</font id="size2">
Quidquid latine dictum sit, altum viditur.</font id="brown">

[edit]Fixed error stated below.[/edit]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 16.12.2003, 14:39
Tim Scarfe Tim Scarfe is offline
Erfahrener Benutzer
 
Join Date: 14.05.2001
Location: United Kingdom
Posts: 1.015
Default

<blockquote id="quote"><span class="smalltext" id="quote">quote:<hr id="quote">
var cal_rem_date = [];
call_rem_date[ call_rem_date.length ++ ] = new CalendarPopup( );
<hr id="quote"></blockquote id="quote"></span id="quote">

I'm pretty sure Brian didn't mean to put in the ++ there..

--
Regards,
Tim Scarfe <tim@developer-x.com>
http://www.developer-x.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 16.12.2003, 15:43
Brian Nickel Brian Nickel is offline
Erfahrener Benutzer
 
Join Date: 11.05.2001
Location: USA
Posts: 1.157
Default

<blockquote id="quote"><span class="smalltext" id="quote">quote:<hr id="quote">I'm pretty sure Brian didn't mean to put in the ++ there..<hr id="quote"></blockquote id="quote"></span id="quote">
*sigh* Its been too long.

<font color="brown"><font face="Courier New">.Brian</font id="Courier New">
<font size="2">Email: kerrick[at]gmx[dot]net - AIM: Brian K Nickel - Yahoo: brian_nickel - Jabber: Kerrick[at]jabber[dot]org - MSN: kerrick[at]gmx[dot]net - ICQ: 118451560</font id="size2">
Quidquid latine dictum sit, altum viditur.</font id="brown">
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not 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 +2. The time now is 08:00.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.