PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old September 17th, 2002, 04:09 PM
chobo4ever chobo4ever is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Vienna, Austria
Posts: 63 chobo4ever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
writing in .js file

My problem is I want to update a message in a javascript file but since its not for me but for somebody who doesnt know anything about coding I just want to display the content he has to change (=the message).

But its somewhere in the code. If I use the fopen/write code from mojo two posts earlier how do I display in the textarea only a bit of the code to edit?

when its edited I could just put the rest of the code before and after the message but how do I retrieve it in the first place?

thx a lot in advance

Reply With Quote
  #2  
Old September 17th, 2002, 05:20 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: writing in .js file

Look at something like this:

php Code:
Original - php Code
  1.  
  2. <?
  3. $string = "<SCRIPT blah blah>function something { var = 'message I want to mess with'; }</SCRIPT>";
  4. $matches = array();
  5.  
  6. preg_match("/var = '(.*?)'/si", $string, $matches);
  7.  
  8. echo $matches[1];
  9. ?>

Reply With Quote
  #3  
Old September 17th, 2002, 06:47 PM
chobo4ever chobo4ever is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Vienna, Austria
Posts: 63 chobo4ever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: writing in .js file

uhm, mojo inserted the content of the html file with "require". it may be a stupid question but how do I get the content in a variable like $string?

thx for your patience ...

Reply With Quote
  #4  
Old September 18th, 2002, 06:41 AM
sarah's Avatar
sarah sarah is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Auckland, New Zealand
Posts: 127 sarah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 32 sec
Reputation Power: 2
Send a message via ICQ to sarah Send a message via AIM to sarah Send a message via Google Talk to sarah
RE: writing in .js file

Personally I'd hand code the change this time and then pass in the message (or message code) from then on.

More work now but you're not left with hard coded alerts.

Post the code if you want suggestions.

Reply With Quote
  #5  
Old September 18th, 2002, 09:19 AM
chobo4ever chobo4ever is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Vienna, Austria
Posts: 63 chobo4ever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: writing in .js file

ok, here is my javascript. Right now its in the page where it should be and its displayed in an iframe but I want to make it an external .js file. Maybe somebody knows how I do it ...

Code:
	<script language="JavaScript1.2">
var marqueewidth=300
var marqueeheight=250
var speed=2
var marqueecontents='27/28 Sept: <a href="../seminare/hackl_pem.html">Hackl, Persönlicher Erfolg, Linz</a><br>27/28 Sept: <a href="../seminare/reichel1.html">Reichel, Reden II, Nürnberg</a><br>30 Sept/ 01 Okt: <a href="../seminare/kobjoll.html">Kobjoll, Europ. Quality Award, Nürnberg</a><br>02/03 Okt: <a href="../seminare/kobjoll.html">Kobjoll, Europ. Quality Award, Nürnberg<br></a>05 Okt: <a href="../seminare/woess.html">Woess, Vortrags-Coaching, Wien</a><br>10/11 Okt: <a href="woess_coaching.html">Woess, Vortrags-Coaching, Wien</a><br>10/11/12 Okt: <a href="../seminare/reichel1.html">Reichel, Reden I, Nürnberg</a><br>19/20 Okt: <a href="../seminare/spitzbartwessinghage.html">Spitzbart/Wessinghage, Fit Forever, Nürnberg</a><br>22/23 Okt: <a href="../seminare/reichel1.html">Reichel, Verhandeln, Nürnberg</a><br>24/25/26 Okt: <a href="../seminare/reichel1.html">Reichel, Reden I, Nürnberg</a><br>25/26/27 Okt: <a href="../seminare/zen.html">Polenski, Zen, Altenmarkt, Sbg</a><br>31 Okt/01 Nov: <a href="../seminare/mccarthy.html">Mellon, Wealth Mastery, Frankfurt</a><br>07/08/09 Nov: <a href="../seminare/reichel1.html">Reichel, Reden I, Nürnberg</a><br>7/8/9/10 Nov: <a href="../seminare/robbins1.html">The Power to Influence</a><br>11/12 Nov: <a href="../seminare/reichel1.html">Reichel, Verhandeln, Nürnberg</a><br>13/14 Nov: <a href="../seminare/reichel1.html">Reichel, Sekretärinnen, Nürnberg<br></a>14/15 Nov: <a href="../seminare/woess.html">Woess/Koller, Vortrag und Stimme, Wien</a><br>15/16 Nov: <a href="../seminare/reichel1.html">Reichel, Reden II, Nürnberg</a><br>21/22/23 Nov: <a href="../seminare/reichel1.html">Reichel, Reden I, Nürnberg</a><br>22/23/24 Nov: <a href="../seminare/zen.html">Polenski, Zen, Niederkleveez, Schleswig-H<br></a>23/24 Nov: <a href="../seminare/robbins1.html">Leadership and Effective Management</a>02/03 Dez: <a href="../seminare/christiani_molcho.html">Christiani/Molcho, Verkauf/Körperspr, Linz</a><br>03/04 Dez: <a href="../seminare/christiani_molcho.html">Christiani/Molcho, Verkauf/Körperspr, München</a><br>09/10/11 Dez: <a href="../seminare/reichel1.html">Reichel, Reden I, Nürnberg</a><br>15 Jan: <a href="../seminare/woess_selbstpraesentation.html">Woess, Souveräne Selbstpräsentation, Wien</a><br>20/21/22/23 Juni 03: <a href="../seminare/robbins1.html">Unleash the Power Within</a>'
if (document.all)
document.write('<marquee direction="up" scrollAmount='+speed+' style="width:'+marqueewidth+';height:'+marqueeheight+'">'+marqueecontents+'</marquee>')
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializemarquee()
}
}

function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.w  rite(marqueecontents)
document.cmarquee01.document.cmarquee02.document.c  lose()
thelength=document.cmarquee01.document.cmarquee02.  document.height
scrollit()
}

function scrollit(){
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.top-=speed
setTimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.top=marque  eheight
scrollit()
}
}

window.onload=regenerate2
</script>

// and here is the iframe:

<ilayer width=&{marqueewidth}; height=&{marqueeheight}; name="cmarquee01">
<layer name="cmarquee02" width=&{marqueewidth}; height=&{marqueeheight};></layer>
</ilayer>


I just want to display the var marqueecontents, it´d be best if I could write every entry/link in marqueecontents seperately/make brakes between them.

I hope somebody can help me.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > writing in .js file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway