扩展HTML元素 [英] Extending HTML Elements

查看:91
本文介绍了扩展HTML元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!


我有一些遗留代码。 DIV用于拖放。一些

支票。检查信息取自DIV的ID。

现在我的问题是:

我还可以从哪里获取信息?

我可以写一些像

< div id =" 1" myPerson = QUOT;乔" myStartTime = QUOT; 10:00" myDuration = QUOT; 120" />

或者只是当前的解决方案

< div id =" 1; Joe; 10:00; 120" />

更好?

或者还有另一个完全不同的解决方案吗?


(我在这个组中问我这个希望信息以HTML格式保存

比稍后使用javascript或保存

在javascript功能中添加信息更好。)


问候,


Rudi

Hi!

I have some legacy code. DIVs are used to be dragged and dropped. Some
checks are made. For the checks information is taken out of the DIVs id.
Now my question is:
Where else could I take the information from?
Could I write something like
<div id="1" myPerson="Joe" myStartTime="10:00" myDuration="120" />
or is only the current solution
<div id="1;Joe;10:00;120" />
better?
Or is there another totally different solution?

(I ask this in this group as I want the information be saved in HTML
better than adding the information later with javascript or "saving"
them within javascript fuctions.)

Regards,

Rudi

推荐答案

2007年4月19日星期四14:46: 16 + 0200,Rudi Hausmann写道:
On Thu, 19 Apr 2007 14:46:16 +0200, Rudi Hausmann wrote:

我可以写一些像

< div id =" 1" myPerson = QUOT;乔" myStartTime = QUOT; 10:00" myDuration = QUOT; 120" />

或者只是当前的解决方案

< div id =" 1; Joe; 10:00; 120" />

更好?
Could I write something like
<div id="1" myPerson="Joe" myStartTime="10:00" myDuration="120" />
or is only the current solution
<div id="1;Joe;10:00;120" />
better?



不,真正的编程语言可以做到这一点,但HTML不能。

你可以拥有多个ID:


< div id =" 1" ID = QUOT; aPerson" id =" Joe" .....................


....但那不是真的和你想要的一样有用。


你可以学习一些服务器端语言,这样你就可以从一个程序生成你的页面,修改它们和它们的CSS根据您将使用的

信息的需要。客户端JavaScript的吸引力不那么大,因为你最终得到的页面很糟糕,因为他们在任何合理的时间内都无法读取


修改。


No, real programming languages can do that, but HTML can''t.
You can have multiple ids:

<div id="1" id="aPerson" id="Joe".....................

....but that''s not really as useful as what you want.

You could learn some server side language so that you can generate
your pages from a program, modifying them and their CSS as needed for the
information you will use. Client side JavaScript is less attractive,
because you end up with pages that are so kludged up with goo that they
are unreadable in any reasonable amount of time when it comes time to make
modifications.



mbstevens写道:
mbstevens wrote:

On Thu,2007年4月19日14:46:16 +0200,Rudi Hausmann写道:
On Thu, 19 Apr 2007 14:46:16 +0200, Rudi Hausmann wrote:

>我可以写一些像
< ; div id =" 1" myPerson = QUOT;乔" myStartTime = QUOT; 10:00" myDuration = QUOT; 120" />
或者只是当前的解决方案
< div id =" 1; Joe; 10:00; 120" />
更好?
>Could I write something like
<div id="1" myPerson="Joe" myStartTime="10:00" myDuration="120" />
or is only the current solution
<div id="1;Joe;10:00;120" />
better?



不,真正的编程语言可以做到这一点,但HTML不可能。


No, real programming languages can do that, but HTML can''t.



我试过:

< div id =" 1"测试= QUOT;哇" />

它工作..我可以用JavaScript访问测试属性。

I tried:
<div id="1" test="wow" />
and it worked.. I could access the test property in JavaScript.


你可以有多个ID:


< div id =" 1" ID = QUOT; aPerson" id =" Joe" .....................


...但这不是真的你想要的是有用的。


你可以学习一些服务器端语言,这样你就可以从一个程序生成你的页面,修改它们和它们的CSS您将使用的

信息需要。
You can have multiple ids:

<div id="1" id="aPerson" id="Joe".....................

...but that''s not really as useful as what you want.

You could learn some server side language so that you can generate
your pages from a program, modifying them and their CSS as needed for the
information you will use.



我们使用服务器端语言,但我们希望对客户端的
进行最少的检查。我们只想在真正需要时才连接到服务器。 (例如保存等)

We use a server side language, but we want to do a minimum of checks on
the client side. We want to connect to the server only when really
required. (e.g. save, etc.)


客户端JavaScript不那么有吸引力,

因为你最终得到的网页如此笨拙goo他们

在任何合理的时间内无法读取

修改。
Client side JavaScript is less attractive,
because you end up with pages that are so kludged up with goo that they
are unreadable in any reasonable amount of time when it comes time to make
modifications.



嗯,没有什么是完美的。

Well, nothing is perfect.


mbstevens< NO *********** @ xmbstevensx.comwrote:
mbstevens <NO***********@xmbstevensx.comwrote:

>您可以拥有多个ID:

< div id =" 1" ID = QUOT; aPerson" id =" Joe" .....................
>You can have multiple ids:

<div id="1" id="aPerson" id="Joe".....................



每个元素只有一个id属性允许。


-

Spartanicus

Only one id attribute per element is allowed.

--
Spartanicus


这篇关于扩展HTML元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆