473,545 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to write complicated codes inline?

I need to convert some long codes inline. I want to know the generate
rules for doing that.

1 first remove <script></script>
2 use / in front of all "s
3 remove all newline characters.

Anything else? Is inline JS sharing varibles and function names in the
html?
I need that info so I can covert many scripts at once by writing some
shell or perl scripts.

Thanks.
Jul 23 '05 #1
1 1525
i6************* ****@yahoo.com. cn wrote:
I need to convert some long codes inline. I want to know the generate
rules for doing that.

1 first remove <script></script>
And if its <script type="text/javascript"> or <script
language="javas cript"> or <script language="JScri pt"> or <script
language="VBScr ipt"> ??

The simple answer is a search and replace with a regular expression.
PERL can very readily handle that.
2 use / in front of all "s
I think you actually want the \ as thats the escape character. Again,
its a search/replace.
3 remove all newline characters.
search and replace.
Anything else? Is inline JS sharing varibles and function names in the
html?
No, it shares variables and functions within the scripts, not in the HTML.
I need that info so I can covert many scripts at once by writing some
shell or perl scripts.


And now you have it.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1742
by: s_m_b | last post by:
function saveState() { document.write (" | <a href = 'myhomepage.asp? view=mhp&amp;action=save&amp;pb="); >> document.write (document.phone.style.display.value); document.write ("'>save view</a>"); }; creates an error at this (>) line.
2
3613
by: robert.waters | last post by:
Hello, I am dynamically editing the contents of a page and using document.write() to reload the new, edited content. However, on the new page, any calls to functions located in external .js files (fyi: same domain) fail with 'object expected' (IE6). If I subsequently reload the page, everything works. Also, if I inline this code,...
7
2317
by: eyh5 | last post by:
Hi, I'm writing some C codes to run simulations. I'm wondering if there is a website that may contain useful information on how to make one's code run more efficiently and in a computational-time-saving manner. Specifically, what I'd like to know is if there're any useful tips about writing your codes more efficiently. One such useful tip...
5
4390
by: Confused User | last post by:
I am working on device that utilizes a Motorola 68HC16 microcontroller. I am using an old unsupported piece of crap Whitesmith's / Intermetrics / Tasking compiler. The embedded compiler business was quite insestual for while wasn't it? I need to write putchar so that printf can function properly. Anyway, the compiler comes with just a shell...
27
5635
by: Sune | last post by:
Hi! Pre-requisites: ------------------- 1) Consider I'm about to write a quite large program. Say 500 K lines. 2) Part of this code will consist of 50 structs with, say, no more than at most 1K bytes of data. 3) These structs are to be used by all of the other 500K lines in various places.
18
2242
by: Ed Jay | last post by:
<disclaimer>js newbie</disclaimer> My page has a form comprised of several radio buttons. I want to poll the buttons to determine which button was selected and convert its value to a string. I then want to use the string on the same page. My script is: function checkRadio(field) { for(var i=0; i < field.length; i++) {
3
8520
by: Billy Smith | last post by:
I'm trying to write a little utility that will write some binary data to a file via a javascript and Windows Script Host under Windows XP. The only way to do this that I can find is to convert the binary data to text via String.fromCharCode() function and then write to the file with TextStream.Write(). But that function gives an "invalid...
5
2960
by: SuneR | last post by:
Hi, I am having problems figuring out how to make Firefox behave, and output the HTML I want it to output. The thing I want done is actually quite simple. I have a <labeltag, and inside it, I have a script tag, that document.write's some HTML. Like this:
11
2812
by: Steven D'Aprano | last post by:
I find myself writing command line tools in Python where I wish to include "verbose" output to stdout. I start with a helper function: def print_(obj, level=0): if _verbosity >= level: print obj
0
7680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7446
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5349
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3459
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.