HighDots Forums  

Imagefields to trigger Javascript

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Imagefields to trigger Javascript in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
trufla
 
Posts: n/a

Default Imagefields to trigger Javascript - 07-30-2004 , 05:38 AM






Hi Guys!

I am using Javascript in Dreamweaver to create a small app that allows a use
to enter a text message into a prompt and see it scroll (using marquee
attribute).
The user can then select button to format the text (font /colour).

I basically want to replace the form buttons with my own creations and I
thought it would be as simple as inserting an image field and attaching the
Javascript ?format? function with ?onclick?.

However, when the user clicks the ?gif button? I made, instead of the
scrolling text changing colour or font the prompt pops up again for them to
retype their message.

Can anyone help?

Script:

<body>
<script language="JavaScript" type="text/javascript">
<!--
function message(usermsg){
document.getElementById('wibble').innerHTML = '<span
style="font-family:arial;font-size:28px">'+usermsg+'</span>';
}
var usermsg = prompt ("Enter your scrolling text message and click 'OK' (200
characters Max)", "");
message(usermsg);
//-->

function times(){
document.getElementById('wibble').innerHTML = '<span
style="font-family:times;font-size:28px">'+usermsg+'</span>';
}

function arial(){
document.getElementById('wibble').innerHTML = '<span
style="font-family:arial;font-size:28px">'+usermsg+'</span>';
}

function monospace(){
document.getElementById('wibble').innerHTML = '<span
style="font-family:monospace;font-size:28px">'+usermsg+'</span>';
}

function black(){
document.fgColor='#000000'
}
//end of function "black()"

function red(){
document.fgColor='red'
}
//end of function "red()"

function blue(){
document.fgColor='#0101B0'
}
//end of function "blue()"

function green(){
document.fgColor='#cccc99"'
}

//end of function "green()"
</script>

<input name="monospace" type="image" src="../images/gifs/submit.gif"
width="60" height="25" border="0" onclick="monospace()" value="monospace"/>

</body>


Reply With Quote
  #2  
Old   
Mick White
 
Posts: n/a

Default Re: Imagefields to trigger Javascript - 07-31-2004 , 06:39 PM






Why not use a normal image?

<a href="#" onclick="monospace(); return false;"><img
src="../images/gifs/submit.gif"
width="60" height="25" border="0"></a>
Mick

trufla wrote:

Quote:
Hi Guys!

I am using Javascript in Dreamweaver to create a small app that allows a use
to enter a text message into a prompt and see it scroll (using marquee
attribute).
The user can then select button to format the text (font /colour).

I basically want to replace the form buttons with my own creations and I
thought it would be as simple as inserting an image field and attaching the
Javascript ?format? function with ?onclick?.

However, when the user clicks the ?gif button? I made, instead of the
scrolling text changing colour or font the prompt pops up again for them to
retype their message.

Can anyone help?

Script:

body
script language="JavaScript" type="text/javascript"
!--
function message(usermsg){
document.getElementById('wibble').innerHTML = '<span
style="font-family:arial;font-size:28px">'+usermsg+'</span>';
}
var usermsg = prompt ("Enter your scrolling text message and click 'OK' (200
characters Max)", "");
message(usermsg);
//--

function times(){
document.getElementById('wibble').innerHTML = '<span
style="font-family:times;font-size:28px">'+usermsg+'</span>';
}

function arial(){
document.getElementById('wibble').innerHTML = '<span
style="font-family:arial;font-size:28px">'+usermsg+'</span>';
}

function monospace(){
document.getElementById('wibble').innerHTML = '<span
style="font-family:monospace;font-size:28px">'+usermsg+'</span>';
}

function black(){
document.fgColor='#000000'
}
//end of function "black()"

function red(){
document.fgColor='red'
}
//end of function "red()"

function blue(){
document.fgColor='#0101B0'
}
//end of function "blue()"

function green(){
document.fgColor='#cccc99"'
}

//end of function "green()"
/script

input name="monospace" type="image" src="../images/gifs/submit.gif"
width="60" height="25" border="0" onclick="monospace()" value="monospace"/

/body


Reply With Quote
  #3  
Old   
trufla
 
Posts: n/a

Default Re: Imagefields to trigger Javascript - 08-02-2004 , 10:22 AM



I didn't know you could do that! Works fine now! Thanks matey!

Reply With Quote
  #4  
Old   
trufla
 
Posts: n/a

Default Re: Imagefields to trigger Javascript - 08-02-2004 , 11:37 AM



Ah, the snag.........If I wanted to insert the info attached to the function I
am triggering with the "gif" and the "onclick" behavior into a database, would
I need the imagefield method over the straight link to the image?




Reply With Quote
  #5  
Old   
trufla
 
Posts: n/a

Default Re: Imagefields to trigger Javascript - 08-03-2004 , 04:41 AM



Can I get the info to a database some other way?

Reply With Quote
Reply




Thread Tools
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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.