Click here to Skip to main content
15,914,165 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: OK, so I have this website... Pin
Roger Wright28-Dec-03 6:22
professionalRoger Wright28-Dec-03 6:22 
GeneralRe: OK, so I have this website... Pin
nssone28-Dec-03 16:42
nssone28-Dec-03 16:42 
GeneralRe: OK, so I have this website... Pin
perlmunger5-Jan-04 12:58
perlmunger5-Jan-04 12:58 
GeneralIexplorer and 8 bit images Pin
georgiek5025-Dec-03 21:17
georgiek5025-Dec-03 21:17 
Questionhow to "setAttribute" for an event Pin
webProgrammer25-Dec-03 15:09
webProgrammer25-Dec-03 15:09 
AnswerRe: how to "setAttribute" for an event Pin
Heath Stewart28-Dec-03 4:21
protectorHeath Stewart28-Dec-03 4:21 
GeneralRe: how to "setAttribute" for an event Pin
webProgrammer28-Dec-03 6:18
webProgrammer28-Dec-03 6:18 
GeneralRe: how to "setAttribute" for an event Pin
Heath Stewart28-Dec-03 6:32
protectorHeath Stewart28-Dec-03 6:32 
You can't add "alert('hi')" - it MUST be a function name (without quotes). Underneath it all, this all comes down to COM implementations. attachEvent takes a string that identifies the event name and a VARIANT that is a function pointer - NOT a string. There is no magic involved here and you must follow symantecs. Instead, try somthing like this:
<script language="javascript">
function sayHi()
{
  alert("Hi!");
}
myElem.onclick = sayHi;
// Or...
myElem.attachEvent("onclick", sayHi);
</script>
When you use setAttribute, you might thing that this would work from an HTML standpoint, but this isn't manipulating the HTML - it's creating an HTML element in the HTML Document Object Model (DOM) that would've otherwise been read by MSHTML from the HTML document. Instead, you must attach the event handler correctly. Again, the event is not an attribute though it can be represented by an attribute. MSHTML will know better and will hookup a function (or create on in memory that wraps the code you put in the HTML attribute) when it reads the HTML attributes on the element.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: how to &quot;setAttribute&quot; for an event Pin
webProgrammer28-Dec-03 15:32
webProgrammer28-Dec-03 15:32 
GeneralRe: how to &quot;setAttribute&quot; for an event Pin
Heath Stewart28-Dec-03 18:03
protectorHeath Stewart28-Dec-03 18:03 
GeneralRe: how to "setAttribute" for an event Pin
Richard Deeming9-Jan-04 7:08
mveRichard Deeming9-Jan-04 7:08 
Generalfixed background in table Pin
Brakanjan25-Dec-03 12:36
Brakanjan25-Dec-03 12:36 
GeneralRe: fixed background in table Pin
l a u r e n25-Dec-03 13:49
l a u r e n25-Dec-03 13:49 
GeneralRe: fixed background in table Pin
Brakanjan26-Dec-03 9:31
Brakanjan26-Dec-03 9:31 
GeneralRe: fixed background in table Pin
l a u r e n26-Dec-03 9:53
l a u r e n26-Dec-03 9:53 
GeneralWeb Site Design Pin
vivek_mastishk24-Dec-03 20:19
vivek_mastishk24-Dec-03 20:19 
GeneralRe: Web Site Design Pin
Sarvesvara (BVKS) Dasa25-Dec-03 8:24
Sarvesvara (BVKS) Dasa25-Dec-03 8:24 
GeneralRe: Web Site Design Pin
alex.barylski25-Dec-03 8:35
alex.barylski25-Dec-03 8:35 
GeneralRe: Web Site Design Pin
brianwelsch26-Dec-03 7:52
brianwelsch26-Dec-03 7:52 
GeneralRe: Web Site Design Pin
theJazzyBrain29-Dec-03 2:05
theJazzyBrain29-Dec-03 2:05 
QuestionWhat font is this?? Pin
Sarvesvara (BVKS) Dasa23-Dec-03 2:48
Sarvesvara (BVKS) Dasa23-Dec-03 2:48 
AnswerRe: What font is this?? Pin
Ian Darling23-Dec-03 3:22
Ian Darling23-Dec-03 3:22 
GeneralRe: What font is this?? Pin
Sarvesvara (BVKS) Dasa25-Dec-03 8:26
Sarvesvara (BVKS) Dasa25-Dec-03 8:26 
GeneralJavascript/Frames Question Pin
Joel Holdsworth23-Dec-03 1:42
Joel Holdsworth23-Dec-03 1:42 
GeneralRe: Javascript/Frames Question Pin
theJazzyBrain23-Dec-03 20:58
theJazzyBrain23-Dec-03 20:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.