PDA

View Full Version : Need help making a code generator and divs



xilovemusic123x
03-04-2009, 12:00 AM
Here's a list of questions.. any help would be extremely appreciated!

1. Can anyone help me make a code generator? Or give me a link to a site which can explain how to make one?
2. Is there a way to make a div appear onclick? Would it be possible to capture the x and y positions of the mouse then make the div appear on that position? Or is there a simpler way?
3. How do I make a popup "preview" that shows the code generated in a new window but on the same page?

I know it's alot to ask but if you could help in ANY way, I would greatly appreciate it!

magicyte
03-04-2009, 01:46 AM
1. Can anyone help me make a code generator? Or give me a link to a site which can explain how to make one?

Easy. Take the code and use document.write(codeValue) to write it onto the webpage. Better yet, this code could be submitted in a form via PHP. It could then be echoed on the webpage via PHP and it won't involve any JavaScript. If you would like a different kind of code generator, let us know which language (it probably can't be PHP or any compiled language...). If I've mistaken you, let me know. You may be wanting a generator that makes code on its own, and not be a 'code parser' or 'code generator' (which is how I say it) which takes programming code and, in a way, makes a program on its own.


2. Is there a way to make a div appear onclick? Would it be possible to capture the x and y positions of the mouse then make the div appear on that position? Or is there a simpler way?

Yes. Look it up on Google. "finding x y coordinates using javascript". I'm lazy, so I don't feel like coding anything right now. :p Let me know if you would like me to code it for you. Then I would.


3. How do I make a popup "preview" that shows the code generated in a new window but on the same page?

You could do this via a <div>, but if this is some sort of 'code parser' (as mentioned in answer 1), it is best accomplished in an <iframe> considering the fact that many browsers today classify a window.open()'ed window is a 'popup'. You wouldn't want to use a <div> when using a 'parser' because it could interfere with other code on the page.

Any other questions? I know that question 1 may have thrown me off... :o

xilovemusic123x
03-04-2009, 05:53 PM
Easy. Take the code and use document.write(codeValue) to write it onto the webpage. Better yet, this code could be submitted in a form via PHP. It could then be echoed on the webpage via PHP and it won't involve any JavaScript. If you would like a different kind of code generator, let us know which language (it probably can't be PHP or any compiled language...). If I've mistaken you, let me know. You may be wanting a generator that makes code on its own, and not be a 'code parser' or 'code generator' (which is how I say it) which takes programming code and, in a way, makes a program on its own.



Yes. Look it up on Google. "finding x y coordinates using javascript". I'm lazy, so I don't feel like coding anything right now. :p Let me know if you would like me to code it for you. Then I would.



You could do this via a <div>, but if this is some sort of 'code parser' (as mentioned in answer 1), it is best accomplished in an <iframe> considering the fact that many browsers today classify a window.open()'ed window is a 'popup'. You wouldn't want to use a <div> when using a 'parser' because it could interfere with other code on the page.

Any other questions? I know that question 1 may have thrown me off... :o

Much thanks Chris! I'll be sure to ask if needed in the future.